package me.firstapp.manage.order;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import me.firstapp.manage.common.BaseManage;
import me.firstapp.module.weixin.order.ProductOrder;
import me.firstapp.service.weixin.product.ProductOrderService;

@Controller
@RequestMapping(value = "/orderManage")
public class OrderManagePage extends BaseManage {

	@Autowired
	private ProductOrderService productOrderService;

	@RequestMapping(value = "/mobileFareOrderList.html", method = RequestMethod.GET)
	public ModelAndView mobileFareOrderListView(HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		return new ModelAndView("order/mobileFareOrderList", modelMap);
	}

	@RequestMapping(value = "/kaMiOrderList.html", method = RequestMethod.GET)
	public ModelAndView kaMiOrderListView(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
		return new ModelAndView("order/kaMiOrderList", modelMap);
	}

	@RequestMapping(value = "/softOrderList.html", method = RequestMethod.GET)
	public ModelAndView softOrderListView(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
		return new ModelAndView("order/softOrderList", modelMap);
	}

	@RequestMapping(value = "/outOrderExchangeList.html", method = RequestMethod.GET)
	public ModelAndView outOrderExchangeListView(HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		return new ModelAndView("order/outOrderExchangeList", modelMap);
	}

	@RequestMapping(value = "/addSoftOrderRemark.html", method = RequestMethod.GET)
	public ModelAndView addSoftOrderRemarkView(String orderNo, HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		modelMap.put("orderNo", orderNo);
		return new ModelAndView("order/addSoftOrderRemark", modelMap);
	}

	@RequestMapping(value = "/addKamiOrderRemark.html", method = RequestMethod.GET)
	public ModelAndView addKamiOrderRemarkView(String orderNo, HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		modelMap.put("orderNo", orderNo);
		return new ModelAndView("order/addKamiOrderRemark", modelMap);
	}

	@RequestMapping(value = "/addMobileOrderRemark.html", method = RequestMethod.GET)
	public ModelAndView addMobileOrderRemarkView(String orderNo, HttpServletRequest request,
			HttpServletResponse response, ModelMap modelMap) {
		modelMap.put("orderNo", orderNo);
		return new ModelAndView("order/addMobileOrderRemark", modelMap);
	}

	@RequestMapping(value = "/paymentRecordList.html", method = RequestMethod.GET)
	public ModelAndView paymentRecordListView(HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		return new ModelAndView("order/paymentRecord", modelMap);
	}

	@RequestMapping(value = "/productOrderList.html", method = RequestMethod.GET)
	public ModelAndView productOrderListView(HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		return new ModelAndView("order/productOrderList", modelMap);
	}

	@RequestMapping(value = "/editProductOrder.html", method = RequestMethod.GET)
	public ModelAndView editProductOrderView(String orderNo, HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		ProductOrder productOrder = productOrderService.findByOrderNo(orderNo);
		modelMap.put("productOrder", productOrder);
		modelMap.put("orderNo", productOrder.getOrderNo());
		return new ModelAndView("order/editProductOrder", modelMap);
	}

	@RequestMapping(value = "/remarkProductOrder.html", method = RequestMethod.GET)
	public ModelAndView remarkProductOrderView(String orderNo, HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		ProductOrder productOrder = productOrderService.findByOrderNo(orderNo);
		modelMap.put("remark", productOrder.getRemark());
		modelMap.put("orderNo", productOrder.getOrderNo());
		return new ModelAndView("order/remarkProductOrder", modelMap);
	}

	@RequestMapping(value = "/sendProductOrder.html", method = RequestMethod.GET)
	public ModelAndView sendProductOrderView(String orderNo, HttpServletRequest request, HttpServletResponse response,
			ModelMap modelMap) {
		ProductOrder productOrder = productOrderService.findByOrderNo(orderNo);
		modelMap.put("productOrder", productOrder);
		modelMap.put("orderNo", productOrder.getOrderNo());
		return new ModelAndView("order/sendProductOrder", modelMap);
	}
}
